package com.china.school;

import com.sun.org.glassfish.gmbal.ParameterNames;
import org.springframework.http.MediaType;
import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

@RestController
@RequestMapping("/file")
public class FileController {

    //指定响应成json
    @GetMapping(value = "/upload"  )
    @ResponseBody
    public ModelAndView upload(   ) throws IOException {
//        FileOutputStream outputStream = new FileOutputStream("E:\\shenniudata\\spring-learning-self\\Spring-WebMvc5\\src\\main\\resources\\photo");
//        outputStream.write(file.getBytes());
        User user = new User();
        user.setName("小明");
        user.setAge(22);
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("/index.html");
        return modelAndView;
    }

    {
        System.out.println("@@@@@@@@@@@@@@@@@@@");
    }
}
